* Fix Parser::unstrip on PHP 5.1.0RC4
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 31 Oct 2005 21:40:18 +0000 (21:40 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 31 Oct 2005 21:40:18 +0000 (21:40 +0000)
RELEASE-NOTES
includes/Parser.php

index 55ea3a5..3ec4a41 100644 (file)
@@ -195,6 +195,7 @@ fully support the editing toolbar, but was found to be too confusing.
 * (bug 3761) Avoid deprecation warnings in Special:Import
 * (bug 2885) Remove unnecessary reference parameter which broke classic skin
   talk notification on PHP 5.0.5
+* Fix Parser::unstrip on PHP 5.1.0RC4
 
 
 === Caveats ===
index bb74782..a39ff5e 100644 (file)
@@ -471,11 +471,10 @@ class Parser
                }
                
                # Must expand in reverse order, otherwise nested tags will be corrupted
-               $contentDict = end( $state );
-               for ( $contentDict = end( $state ); $contentDict !== false; $contentDict = prev( $state ) ) {
-                       if( key($state) != 'nowiki' && key($state) != 'html') {
-                               for ( $content = end( $contentDict ); $content !== false; $content = prev( $contentDict ) ) {
-                                       $text = str_replace( key( $contentDict ), $content, $text );
+               foreach( array_reverse( $state, true ) as $tag => $contentDict ) {
+                       if( $tag != 'nowiki' && $tag != 'html' ) {
+                               foreach( array_reverse( $contentDict, true ) as $uniq => $content ) {
+                                       $text = str_replace( $uniq, $content, $text );
                                }
                        }
                }